DROP TABLE IF EXISTS table_11733 ;
set @orig_sql_mode= @@sql_mode;
set global read_only=0;
create table table_11733 (a int) engine=InnoDb;
BEGIN;
insert into table_11733 values(11733);
set global read_only=1;
select @@global.read_only;
select * from table_11733 ;
COMMIT;
set global read_only=0;
drop table table_11733 ;
CREATE TABLE t1(a INT) ENGINE=INNODB;
INSERT INTO t1 VALUES (0), (1);
SET GLOBAL read_only=1;
SELECT * FROM t1;
BEGIN;
SELECT * FROM t1;
COMMIT;
SET GLOBAL read_only=0;
FLUSH TABLES WITH READ LOCK;
SELECT * FROM t1;
BEGIN;
SELECT * FROM t1;
COMMIT;
UNLOCK TABLES;
DROP TABLE t1;
DROP DATABASE IF EXISTS db1;
CREATE DATABASE db1;
CREATE TABLE db1.t1 (a INT) ENGINE=INNODB;
CREATE TABLE db1.t2 (a INT) ENGINE=INNODB;
INSERT INTO db1.t1 VALUES (1);
INSERT INTO db1.t2 VALUES (2);
SET GLOBAL READ_ONLY = ON;
CREATE TEMPORARY TABLE temp (a INT) ENGINE=INNODB;
INSERT INTO temp VALUES (1);
DROP TABLE temp;
CREATE TEMPORARY TABLE temp (a INT) ENGINE=INNODB;
LOCK TABLES t1 READ, t2 READ;
SELECT * FROM t1;
INSERT INTO temp values (1);
SELECT * FROM t2;
UNLOCK TABLES;
DROP TABLE temp;
BEGIN;
SELECT * FROM t1;
CREATE TEMPORARY TABLE temp (a INT) ENGINE=INNODB;
INSERT INTO t1 VALUES (1);
INSERT INTO temp VALUES (1);
SELECT * FROM t2;
ROLLBACK;
SELECT * FROM temp;
DROP TABLE temp;
CREATE TEMPORARY TABLE temp (a INT) ENGINE=INNODB;
LOCK TABLES t1 READ, temp WRITE;
SELECT * FROM t1;
SELECT * FROM temp;
INSERT INTO t1 VALUES (1);
INSERT INTO temp VALUES (1);
DROP TABLE temp;
UNLOCK TABLES;
CREATE TEMPORARY TABLE t1 (a INT) ENGINE=INNODB;
LOCK TABLES t1 WRITE;
DROP TABLE t1;
SELECT * FROM t1;
CREATE TEMPORARY TABLE temp1 (a INT) ENGINE=INNODB;
CREATE TEMPORARY TABLE temp2 LIKE temp1;
BEGIN;
INSERT INTO temp1 VALUES (10);
INSERT INTO temp2 VALUES (10);
INSERT INTO temp1 SELECT * FROM t1;
INSERT INTO temp2 SELECT * FROM t2;
SELECT * FROM temp1 ORDER BY a;
SELECT * FROM temp2 ORDER BY a;
ROLLBACK;
SELECT * FROM temp1,temp2;
LOCK TABLES t1 READ, t2 READ;
INSERT INTO temp1 VALUES (10);
INSERT INTO temp2 VALUES (10);
INSERT INTO temp1 SELECT * FROM t1;
INSERT INTO temp2 SELECT * FROM t2;
SELECT * FROM temp1 ORDER BY a;
SELECT * FROM temp2 ORDER BY a;
UNLOCK TABLES;
DELETE temp1, temp2 FROM temp1, temp2;
INSERT INTO temp1 VALUES (10);
INSERT INTO temp2 VALUES (10);
INSERT INTO temp1 SELECT * FROM t1;
INSERT INTO temp2 SELECT * FROM t2;
SELECT * FROM temp1 ORDER BY a;
SELECT * FROM temp2 ORDER BY a;
DROP TABLE temp1, temp2;
CREATE TEMPORARY TABLE temp1 (a INT) ENGINE=INNODB;
CREATE TEMPORARY TABLE temp2 LIKE temp1;
INSERT INTO temp1 (a) VALUES ((SELECT MAX(a) FROM t1));
LOCK TABLES t2 READ;
INSERT INTO temp2 (a) VALUES ((SELECT MAX(a) FROM t2));
UNLOCK TABLES;
LOCK TABLES t1 READ, t2 READ;
INSERT INTO temp1 SELECT * FROM t1 WHERE a < (SELECT MAX(a) FROM t2);
INSERT INTO temp2 SELECT * FROM t2 WHERE a > (SELECT MAX(a) FROM t1);
UNLOCK TABLES;
INSERT INTO temp1 SELECT * FROM t1 WHERE a < (SELECT MAX(a) FROM t2);
INSERT INTO temp2 SELECT * FROM t2 WHERE a > (SELECT MAX(a) FROM t1);
SELECT * FROM temp1 ORDER BY a;
SELECT * FROM temp2 ORDER BY a;
DROP TABLE temp1, temp2;
CREATE TEMPORARY TABLE temp1 (a INT) ENGINE=INNODB;
CREATE TEMPORARY TABLE temp2 LIKE temp1;
INSERT INTO temp1 VALUES (1),(2);
INSERT INTO temp2 VALUES (3),(4);
UPDATE temp1,temp2 SET temp1.a = 5, temp2.a = 10;
SELECT * FROM temp1, temp2;
DROP TABLE temp1, temp2;
